package com.lglin.common.config.exception;

import com.lglin.common.utils.reponse.ResultEnum;
import lombok.Setter;

public class SelfException extends RuntimeException {
    @Setter
    private ResultEnum resultEnum;

    @Setter
    private Integer code;

    @Setter
    private String message;


    public SelfException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
        this.message = resultEnum.getMsg();
    }

    public SelfException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public SelfException(String message) {
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
